package lng.site.tatoo.jobEmail;

import java.net.*;
import java.io.*;

public class CheckEmail{
	
	 public static String getText(String url) throws Exception {
		 String loginPassword ="tmavdm:rootvdm2012";
			URL url_ = new URL(url);
	    	String encoded = new sun.misc.BASE64Encoder().encode(loginPassword.getBytes());
	    	URLConnection connection = url_.openConnection();
	    	connection.setRequestProperty ("Authorization", "Basic " + encoded);
	        BufferedReader in = new BufferedReader(
	                                new InputStreamReader(
	                                    connection.getInputStream()));

	        StringBuilder response = new StringBuilder();
	        String inputLine;

	        while ((inputLine = in.readLine()) != null) 
	            response.append(inputLine);

	        in.close();

	        return response.toString();
	    }

	    public static void main(String[] args) throws Exception {
	        String content = CheckEmail.getText("https://mail.google.com/mail/feed/atom/");
	        System.out.println(content);

	    }
}   